//
//  User.m
//  HotWord
//
//  Created by Rainbow on 7/22/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "User.h"

@implementation User
@synthesize userId;
@synthesize email;
@synthesize password;
@synthesize nickname;
@synthesize gender;
@synthesize longitude;
@synthesize latitude;
@synthesize avater;
@synthesize avater1;
@synthesize avater2;
@synthesize lastLogin;
@synthesize lastMsg;
@synthesize exam;
@synthesize year;
@synthesize applyYear;
@synthesize major;
@synthesize country;
@synthesize city;
@synthesize status;
@synthesize dreamSchool;
@synthesize dreamSchoolCN;
@synthesize dreamSchoolEN;
@synthesize distance;
@synthesize identity;
@synthesize testSection;
@synthesize match;

- (void)encodeWithCoder:(NSCoder *)aCoder
{
	[aCoder encodeObject:self.userId forKey:@"userId"];
	[aCoder encodeObject:self.email forKey:@"email"];
	[aCoder encodeObject:self.password forKey:@"password"];
	[aCoder encodeObject:self.nickname forKey:@"nickname"];
	[aCoder encodeObject:self.gender forKey:@"gender"];
	[aCoder encodeObject:self.longitude forKey:@"longitude"];
	[aCoder encodeObject:self.latitude forKey:@"latitude"];
	[aCoder encodeObject:self.avater forKey:@"avater"];
	[aCoder encodeObject:self.avater1 forKey:@"avater1"];
	[aCoder encodeObject:self.avater2 forKey:@"avater2"];
	[aCoder encodeObject:self.lastLogin forKey:@"lastLogin"];
	[aCoder encodeObject:self.lastMsg forKey:@"lastMsg"];
	[aCoder encodeObject:self.exam forKey:@"exam"];
	[aCoder encodeObject:self.year forKey:@"year"];
	[aCoder encodeObject:self.applyYear forKey:@"applyYear"];
    [aCoder encodeObject:self.major forKey:@"major"];
	[aCoder encodeObject:self.country forKey:@"country"];
	[aCoder encodeObject:self.city forKey:@"city"];
	[aCoder encodeObject:self.status forKey:@"status"];
	[aCoder encodeObject:self.dreamSchool forKey:@"dreamSchool"];
	[aCoder encodeObject:self.dreamSchoolCN forKey:@"dreamSchoolCN"];
	[aCoder encodeObject:self.dreamSchoolEN forKey:@"dreamSchoolEN"];
    
    [aCoder encodeObject:self.identity forKey:@"identity"];
    [aCoder encodeObject:self.testSection forKey:@"testSection"];
    [aCoder encodeObject:self.match forKey:@"match"];



}

- (id)initWithCoder:(NSCoder *)aDecoder
{
	if ([self init]) {
		self.userId= [aDecoder decodeObjectForKey:@"userId"];
		self.email = [aDecoder decodeObjectForKey:@"email"];
		self.password = [aDecoder decodeObjectForKey:@"password"];
		self.nickname= [aDecoder decodeObjectForKey:@"nickname"];
		self.gender= [aDecoder decodeObjectForKey:@"gender"];
		self.longitude= [aDecoder decodeObjectForKey:@"longitude"];
		self.latitude= [aDecoder decodeObjectForKey:@"latitude"];
		self.avater= [aDecoder decodeObjectForKey:@"avater"];
		self.avater1= [aDecoder decodeObjectForKey:@"avater1"];
		self.avater2= [aDecoder decodeObjectForKey:@"avater2"];
		self.lastLogin= [aDecoder decodeObjectForKey:@"lastLogin"];
		self.lastMsg= [aDecoder decodeObjectForKey:@"lastMsg"];
		self.exam = [aDecoder decodeObjectForKey:@"exam"];
		self.year = [aDecoder decodeObjectForKey:@"year"];
		self.applyYear= [aDecoder decodeObjectForKey:@"applyYear"];
        self.major= [aDecoder decodeObjectForKey:@"major"];
		self.country= [aDecoder decodeObjectForKey:@"country"];
		self.city= [aDecoder decodeObjectForKey:@"city"];
		self.status= [aDecoder decodeObjectForKey:@"status"];
		self.dreamSchool= [aDecoder decodeObjectForKey:@"dreamSchool"];
		self.dreamSchoolCN= [aDecoder decodeObjectForKey:@"dreamSchoolCN"];
		self.dreamSchoolEN= [aDecoder decodeObjectForKey:@"dreamSchoolEN"];
        
        self.identity = [aDecoder decodeObjectForKey:@"identity"];
        self.testSection = [aDecoder decodeObjectForKey:@"testSection"];
        self.match = [aDecoder decodeObjectForKey:@"match"];


    }
	return self;
}

- (void)copyFromUser:(User *)user
{
    self.userId = user.userId;
    self.email = user.email;
    self.password = user.password;
    self.nickname = user.nickname;
    self.gender = user.gender;;
    self.longitude = user.longitude;
    self.latitude = user.latitude;
    self.avater = user.avater;
    self.avater1 = user.avater1;
    self.avater2 = user.avater2;
    self.lastLogin = user.lastLogin;
    self.lastMsg = user.lastMsg;
    self.exam = user.exam;
    self.year = user.year;
    self.applyYear = user.applyYear;
    self.major = user.major;
    self.country = user.country;
    self.city = user.city;
    self.status = user.status;
    self.dreamSchool = user.dreamSchool;
    self.dreamSchoolEN = user.dreamSchoolEN;
    self.dreamSchoolCN = user.dreamSchoolCN;
    
    self.identity = user.identity;
    self.testSection = user.testSection;
    self.match = user.match;
}

-(void)dealloc
{
    [userId release];
    [email release];
    [password release];
    [nickname release];
    [gender release];
    [longitude release];
    [latitude release];
    [avater release];
    [avater1 release];
    [avater2 release];
    [lastLogin release];
    [lastMsg release];
    [exam release];
    [year release];
    [applyYear release];
    [major release];
    [country release];
    [city release];
    [status release];
    [dreamSchool release];
    [dreamSchoolCN release];
    [dreamSchoolEN release];
    [distance release];
    
    [identity release];
    [testSection release];
    [match release];
    [super dealloc];
}

@end
